<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>QQ音乐-用户注册</title>
<link rel="stylesheet" href="/static/login/css/style.css">
<script src="/static/js/gt.js"></script>
<script src="/static/js/jquery-1.12.3.min.js"></script>
<style>

    .inp {
        border: 1px solid gray;
        padding: 0 10px;
        width: 200px;
        height: 30px;
        font-size: 18px;
    }

    #embed-captcha {
        width: 300px;
        margin: 20px auto;
    }
    .show {
        display: block;
    }

    #notice {
        color: red;
    }
    .butt{
        width: 100%;
        background: #1e7bdc;
        box-shadow: none;
        border: 0;
        border-radius: 3px;
        line-height: 41px;
        color: #fff;
        display: block;
        font-size: 15px;
        cursor: pointer;
        font-family: 'Microsoft Yahei';
    }
    .butt:hover{
        background: #1e7bdc;
    }
</style>
</head>
<body>

<div class="register-container">
    <img src="/static/images/logo.png" style="width: 200px">

	<div class="connect">
		<p>欢迎登录QQ音乐</p>
	</div>

	<form action="" method="post" id="registerForm">
		<div>
			<input type="text" name="username" class="username" placeholder="您的用户名" autocomplete="off">
		</div>
		<div>
			<input type="password" name="password" class="password" placeholder="输入密码" oncontextmenu="return false" onpaste="return false">
		</div>
		<div>
			<input type="password" name="confirm_password" class="confirm_password" placeholder="再次输入密码" oncontextmenu="return false" onpaste="return false">
		</div>
		<div>
			<input type="text" name="phone_number" class="phone_number" placeholder="输入手机号码" autocomplete="off" id="number">
		</div>
          <div id="embed-captcha"></div>
            <p id="wait" class="show" style="display: none">正在加载验证码......</p>
            <p id="notice" class="hide" style="display: none">请先拖动验证码到相应位置</p>
{#		<button id="submit" type="submit">注 册</button>#}
        <button type="submit" id="embed-submit">注册</button>


	</form>
	<a href="/login">
		<button type="button" class="register-tis">已经有账号？</button>
	</a>

</div>

<script>
    var handlerEmbed = function (captchaObj) {
        $("#embed-submit").click(function (e) {
            var validate = captchaObj.getValidate();
            if (!validate) {
                $("#notice")[0].className = "show";
                setTimeout(function () {
                    $("#notice")[0].className = "hide";
                }, 2000);
                e.preventDefault();
            }
        });
        // 将验证码加到id为captcha的元素里，同时会有三个input的值：geetest_challenge, geetest_validate, geetest_seccode
        captchaObj.appendTo("#embed-captcha");
        captchaObj.onReady(function () {
            $("#wait")[0].className = "hide";
        });
        // 更多接口参考：http://www.geetest.com/install/sections/idx-client-sdk.html
    };
    $.ajax({
        // 获取id，challenge，success（是否启用failback）
        url: "/pc-geetest/register?t=" + (new Date()).getTime(), // 加随机数防止缓存
        type: "get",
        dataType: "json",
        success: function (data) {
            // 使用initGeetest接口
            // 参数1：配置参数
            // 参数2：回调，回调的第一个参数验证码对象，之后可以使用它做appendTo之类的事件
            initGeetest({
                gt: data.gt,
                challenge: data.challenge,
                product: "float", // 产品形式，包括：float，embed，popup。注意只对PC版验证码有效
                offline: !data.success // 表示用户后台检测极验服务器是否宕机，一般不需要关注
                // 更多配置参数请参见：http://www.geetest.com/install/sections/idx-client-sdk.html#config
            }, handlerEmbed);

        }
    });
</script>

<script src="/static/login/js/jquery.min.js"></script>
<script src="/static/login/js/common.js"></script>
<!--背景图片自动更换-->
<script src="/static/login/js/supersized.3.2.7.min.js"></script>
<script src="/static/login/js/supersized-init.js"></script>
<!--表单验证-->
<script src="/static/login/js/jquery.validate.min.js"></script>
{% if messages %}
    <script>
        {% for msg in messages %}
            alert('{{ msg.message }}');
        {% endfor %}
    </script>
{% endif %}
</body>
</html>
